//
//  PersonalInformationViewController.m
//  chongwu
//
//  Created by 隼目 on 2021/9/23.
//

#import "PersonalInformationViewController.h"
#import "PersonalInformationTableViewCell.h"
#import "AuthenticationViewController.h"
@interface PersonalInformationViewController ()<UITableViewDelegate,UITableViewDataSource,personalInformationDelegate>
@property(nonatomic,strong)BaseTableView *tableView;
@property(nonatomic,strong)UIImage *userImage;
@end

@implementation PersonalInformationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title=@"个人信息";
    
    self.tableView=[BaseTableView new];
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(0);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    self.tableView.backgroundColor=rgba(245, 246, 246, 1);
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
    if (@available(iOS 11.0, *)) {
        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    PersonalInformationTableViewCell *cell=[[PersonalInformationTableViewCell alloc] init];
    cell.delegate=self;
    if (indexPath.row==0) {
        cell.userImage=self.userImage;
        [cell creatView];
    }else if (indexPath.row==1) {
        [cell creatBtnView];
    }
   
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if (indexPath.row==0) {
        return 616*_mainHeight;
    }
    return 167*_mainHeight;;
}
-(void)selectSelectPicture{
    SelectPictureView *view=[SelectPictureView new];
    [self.view.window addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.mas_equalTo(0);
    }];
    view.controller=self;
    view.SelectPictureBlock = ^(UIImage * _Nonnull image) {
        self.userImage=image;
        [self.tableView reloadData];
    };
    [view creatView];
}
-(void)selectCustomerType{
    SelectView *view=[SelectView new];
    [self.view.window addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.top.mas_equalTo(0);
    }];
    view.tableArr=@[@{@"vule":@"个人"},@{@"vule":@"宠物店"},@{@"vule":@"犬舍"},@{@"vule":@"猫舍"},@{@"vule":@"其他"}];
    [view creatView];
}
-(void)pushToController{
    AuthenticationViewController *vc=[[AuthenticationViewController alloc] init];
    vc.isHidenDog=YES;
    [ZQTools pushRootViewController:self andNextController:vc];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
